<!DOCTYPE html>
<html>
<head>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/gray/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
	<script type="text/javascript" src="__PUBLIC__/js/add-tab.js"></script>
</head>
<body>
	<div id="tb" style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="javascript:void(0);" src="__URL__/checkProcess" class="cs-navi-tab-check easyui-linkbutton" id="checkProcess" iconCls="icon-employe-add">审批</a>
		</div>
	</div>
	<table id="tt" class="easyui-datagrid" title="代办流程" style="width:auto;height:auto"
			data-options="rownumbers:true,singleSelect:true,url:'__URL__/processListCheckData',toolbar:'#tb',iconCls:'icon-approval'" rownumbers="true" pagination="true" fitColumns="true" fit="true" pageSize="20" pageList="[20,40,80]">
		<thead>
			<tr>
				<th data-options="field:'process_num',align:'center'" width="80">流水号</th>  
				<th data-options="field:'process_title',width:80,align:'center'">流程名称</th>
				<th data-options="field:'process_begin_id',width:100,align:'center'">发起人员</th>
				<th data-options="field:'process_now_id',width:80,align:'center'">当前人员</th>
				<th data-options="field:'process_time',width:80,align:'center'"  formatter="formatTime">发起时间</th>
				<th data-options="field:'process_state',width:240,align:'center'">状态</th>
			</tr>
		</thead>
	</table>

<script type="text/javascript">
	function formatTime(val,row) {     
   	 	return new Date(parseInt(val) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
	}
    $(function(){
		var i=1;
		$('#tt').datagrid({
			onDblClickRow: function(rowIndex,rowData){
					var $this = $('.cs-navi-tab-check');
					var href = $this.attr('src') + '?process_id=' + rowData.process_id + '&process_type=' + rowData.process_type + '&process_num=' + rowData.process_num;
					var title = $this.text()+i;
					i++;
					addTab(title, href);
			}
		});
		$('#checkProcess').click(function(){
			var row = $('#tt').datagrid('getSelected');
			if(row){
				var $this = $('.cs-navi-tab-check');
				var href = $this.attr('src') + '?process_type=' + row.process_type + '&process_id=' + row.process_id + '&process_num=' + row.process_num;
				var title = $this.text()+i;
				i++;
				addTab(title, href);
			}
			else {
            	$.messager.alert('提示', '请选择一条流程', 'info');
            }
		})
	})
</script>
</body>
</html>